package com.mysoft.gfyx.marketdevelop.mip.dto;

import lombok.Data;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

@Data
public class SearchCommencePermitRequestDto extends SearchBaseRequestDto {
    private String keyword;
    private String province_code;
    private String city_code;
    private String company_type_label;
    private String areaLower;
    private String areaUpper;
    private String priceLower;
    private String priceUpper;
    private String beginLower;
    private String beginUpper;
    private String finishLower;
    private String finishUpper;
    private int page = 1;
    private int pageSize;

    protected void setFilterByField(String field, String operatorType, Object value) {
        switch (field) {
            case "construction_area":
                if ("ge".equals(operatorType) || "gt".equals(operatorType)) {
                    this.setAreaLower(value.toString());
                } else if ("le".equals(operatorType) || "lt".equals(operatorType)) {
                    this.setAreaUpper(value.toString());
                }
                break;
            case "contract_price":
                if ("ge".equals(operatorType) || "gt".equals(operatorType)) {
                    this.setPriceLower(value.toString());
                } else if ("le".equals(operatorType) || "lt".equals(operatorType)) {
                    this.setPriceUpper(value.toString());
                }
                break;
            case "start_time":
                if ("ge".equals(operatorType) || "gt".equals(operatorType)) {
                    this.setBeginLower(value.toString());
                } else if ("le".equals(operatorType) || "lt".equals(operatorType)) {
                    this.setBeginUpper(value.toString());
                }
                break;
            case "completed_time":
                if ("ge".equals(operatorType) || "gt".equals(operatorType)) {
                    this.setFinishLower(value.toString());
                } else if ("le".equals(operatorType) || "lt".equals(operatorType)) {
                    this.setFinishUpper(value.toString());
                }
                break;
            default:
                this.dynamicSetProperty(field, value);
        }
    }
}
